<template >
      <div id="bz">
            <el-dialog
            :title="DialogData.title"
            :visible.sync="DialogData.show"
            width="50%"
            >
                  <div class="form">
                        <el-input v-model="formData.comment"></el-input>
                  </div>
                  <span slot="footer" class="dialog-footer">
                  <el-button @click="DialogData.show = false">取 消</el-button>
                  <el-button type="primary" @click="subForm">确 定</el-button>
                  </span>
            </el-dialog>
      </div>
</template>

<script>
      export default {
            props: {
                  DialogData: Object,
                  formData: Object
            },
            data() {
                  return {
                        commemt: '',
                  }
            },
            computed: {
                  token() {
                        return localStorage.miniToken
                  }
            },
            methods: {
                  async subForm() {
                        if (!this.formData.comment) {
                              this.$message.error("备注不能为空")
                        } else {
                              this.formData.token = this.token
                              let res = await this.$axios.post("/admin/index/comment", this.formData)
                              // console.log(res);
                              let code = res.data.code
                              if (code == 202) {
                                    this.$message.success("添加成功!")
                                    this.$emit("update")
                                    this.DialogData.show = false
                              }
                        }
                  }
            },
      }
</script>

<style lang="scss" scoped>

</style>